#ifndef WIDGETS_H
#define WIDGETS_H

#include <QWidget>
#include <QIcon>
#include <QTimer>
#include <QPainter>
#include <QMouseEvent>
#include <QKeyEvent>
#include <ctime>
#include <QSound>
//#include <QResource>
#include <QSoundEffect>
#include <QDialog>
#include <QPushButton>
#include <QVBoxLayout>
#include "config.h"
#include "map.h"
#include "plane.h"
#include "bullet.h"
#include "enemyplane.h"
#include "bomb.h"
#include "startwindow.h"

QT_BEGIN_NAMESPACE
namespace Ui { class Widgets; }
QT_END_NAMESPACE

class Widgets : public QWidget
{
    Q_OBJECT

public:
    Widgets(QWidget *parent = nullptr);
    ~Widgets();

    void initScene();

    void playGame();

    void updatePosition();

    void paintEvent(QPaintEvent *event);

    void mouseMoveEvent(QMouseEvent *event);

    void keyPressEvent(QKeyEvent *event);

    void keyReleaseEvent(QKeyEvent *event);

    void setPosition();

    void enemyToScene();

    void collisionDelection();

    void gameOver();

    void buttonSlot();
private:
    Ui::Widgets *ui;
    QTimer* timer;
    QTimer timer2;
    map Map;
    plane Plane;
    enemyplane Enemyplane[ENEMY_NUM];
    int  enemy_recorder;
    bomb Bomb[BOMB_NUM];
    QSoundEffect soundEffect;
    QDialog* dialog;
    QPushButton* button;
    QPushButton* button2;
    QVBoxLayout* vlayout;
    StartWindow* startgame;
    bool plane_up=false;
    bool plane_down=false;
    bool plane_left=false;
    bool plane_right=false;
};
#endif // WIDGETS_H
